#include <iostream>
#include<vector>
using namespace std;
string s;
bool huiwen() {
    vector<int> a;
    for (int i = 0; i < s.length(); i++) {
        if (s[i] != 'l' && s[i] != 'q' && s[i] != 'b') a.push_back(i);
    }
    if (a.size() == 0)
        return true;
    int left = a[0], right = a[a.size() - 1];
    while (left <= right && s[left++] == s[right--]) {
    }
    if (left > right)
        return true;
    else
        return false;
}
int main()
{
    int t; cin >> t;
    for (int i = 0; i < t; i++) {
        cin >> s;
        if (huiwen()) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}